package com.example.admin.utils;

import com.alibaba.druid.sql.visitor.functions.If;

import java.util.Map;
import java.util.Set;

public class UrlUtil {
    //http:localhost:8080/iot/queryproductlist?lastid=1&limit=5
    public static String geturl(Map<String,Object> params){
        Set<String> keys = params.keySet();
        Boolean title = true;
        StringBuffer start = new StringBuffer("");

        for (String key : keys) {
            String parm = params.get(key).toString();
           if (StringUtils.isNotEmpty(parm)){
               if (title == true){
                   title = false;
                   start.append("?"+key+"="+parm);
                   continue;
               }
               start.append("&"+key+"="+parm);
           }
        }
        return start.toString();
    }
}
